/*
 * @(#)GrayPalette.java	0.1 2002-06-26
 * 
 * Copyleft 2002 Wonseok Shin, Taeksoo Jung
 * Anyone can get benefits from this.
 */
package cs348a.color;

/**
 * A <code>GrayPalette</code> defines a gray palette.
 * 
 * @version	0.1
 * @author		Wonseok Shin, Taeksoo Jung
 * @since		0.1
 */
public final class GrayPalette extends BasicPalette {
	/** Singleton instance */
	public static final GrayPalette INSTANCE = getInstance();
	
	/**
	 * Constructor for <code>GrayPalette</code>.
	 * 
	 * @param reds array of red components
	 * @param greens array of green components
	 * @param blues array of blue components
	 */
	private GrayPalette(byte[] reds, byte[] greens, byte[] blues) {
		super("Gray", reds, greens, blues);
	}
	
	/**
	 * Creates an instance.
	 * 
	 * @return GrayPalette an instance.
	 */
	private static GrayPalette getInstance() {
		// Creates arrays of components.
		byte[] reds = new byte[SIZE];
		byte[] greens = new byte[SIZE];
		byte[] blues = new byte[SIZE];
		
		// Constructs the components.
		for (int i = 0; i < SIZE; i++) {
			reds[i] = (byte) i;
			greens[i] = (byte) i;
			blues[i] = (byte) i;
		}
		
		return new GrayPalette(reds, greens, blues);
	}
}
